<?php
/**
 * Created by PhpStorm.
 * User: ciwei
 * Date: 2017/12/4
 * Time: 13:45
 */
namespace app\index\controller;

use think\Controller;
use think\Loader;
use think\Request;

class Answer extends Common
{
    public function add()
    {
        $data = Request::instance()->param();
        $data['ctime'] = time();
        $validate = Loader::validate('Question');
        if(!$validate->scene('answer')->check($data)){
            exit(json_encode(['error'=>1,'info'=>$validate->getError()]));
        }
        $answer = new \app\index\model\Answer();
        $answer->addAnswer($data);
    }
    public function caina()
    {

        $data = input('post.');
        $data['suid'] = session('uid');
        if ($data['duid'] == $data['suid']){
            exit(json_encode(['error'=>1,'info'=>'请不要采纳自己']));
        }
        $answer = new \app\index\model\Answer();
        $answer->checkCaina($data);
    }


}
